/**
* file name  : it/ciano/jenoware/Phenotype.java
* authors    : Luciano Xumerle
* created    : dom 05 set 2004 10:53:25 CEST
* 
* Copyright (c) 2004-2005 Luciano Xumerle. All rights reserved.
*
* This file is part of gephinfo.
*
* gephinfo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/

package it.ciano.jenoware;

/**
 * The class extends Value and stores the phenotype name.
 * 
 * @author Luciano Xumerle
 * @version 0.0.1
 */
public class Phenotype extends Value implements Comparable
{
    // GLOBAL PRIVATE VARS
    private String _name = null;

    /**
     * Class Constructor.
     *  
     * @param name  the phenotype name.
     * @param value the phenotype value.
     */
    public Phenotype ( String name, String value )
    {
        super( value, false );
        _name = name;
    }

    /**
     * Returns the phenotype name.
     * 
     * @return the phenotype name.
     */
    public String getName()
    {
        return _name;
    }

    /**
     * Overriding toString method.
     * 
     * @return the string "name: value".
     */
    public String toString()
    {
        return _name + ": " + getValue();
    }

    /**
     * Overriding equals method.
     * 
     * @param o the object to compare.
     * @return true or false.
     */
    public boolean equals( Object o )
    {
        Phenotype oth = ( Phenotype ) o;
        return ( _name.equals( oth._name ) && super.equals( o ) );
    }

    /**
     * Overriding clone method.
     * 
     * @return the cloned Object.
     */
    public Object clone()
    {
        Phenotype cloned = new Phenotype( _name, super.getValue() );
        return ( Object ) cloned;
    }

    /**
     * Overriding compareTo method.
     * 
     * @param o the object to compare.
     * @return an integer less or equal or major of 0.
     */
    public int compareTo( Object o )
    {
        return super.compareTo( o );
    }

} // end class

